<?php

use App\Http\Controllers\GuanyuanSSO\Web\GuanyuanAccountController;
use App\Http\Middleware\OpenShop\FeishuWebAuth;
use App\Http\Middleware\OpenShop\UserPermissionAuth;
use Illuminate\Support\Facades\Route;

// 观远飞书客户端路由
Route::get('index', 'LoginController@index');
Route::get('login', 'LoginController@login');


Route::prefix("web")->group(
    function () {
        Route::middleware([FeishuWebAuth::class, UserPermissionAuth::class])->group(
            function () {

                // 观远账号
                Route::prefix('guanyuanAccount')->group(
                    function () {
                        Route::post("/add", [GuanyuanAccountController::class, "add"]);
                        Route::put("/update/{id}", [GuanyuanAccountController::class, "update"])->where('id', '\d+');
                        Route::get("/info/{id}", [GuanyuanAccountController::class, "info"])->where('id', '\d+');
                        Route::delete("/del/{id}", [GuanyuanAccountController::class, "del"])->where('id', '\d+');
                        Route::get('/list', [GuanyuanAccountController::class, 'list']);

                        //和飞书用户绑定
                        Route::post("/bindAdd/{id}", [GuanyuanAccountController::class, "bindAdd"])->where('id', '\d+');
                        Route::get("/fsUserList", [GuanyuanAccountController::class, "fsUserList"]);
                        Route::get("/getBindFsUser", [GuanyuanAccountController::class, "getBindFsUser"]);
                    }
                );
            }
        );

    }
);
